<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class Cms_IndexController extends Zend_Controller_Action 
{
    
	
	public function indexAction() 
    {
        # Проверка доступа
        
        $auth = CmsAuth::getInstance();
        
        if ($this->_request->isPost()) {
        	$result = $auth->authenticate($this->_request->getParam('login'),$this->_request->getParam('password'));
        	$this->view->assign('auth_mesages',$result->getMessages());
        }
        
        if ($auth->getIdentity()=="0") {
//        	$this->_helper->layout->disableLayout();
//        	$this->view->auth_form = new CmsAuthForm();
        	$this->render('auth');
//        	$this->view->render('index/.phtml');
        } else {
        	
        }
    }
    
    public function exitAction() {
    	CmsAuth::getInstance()->clearIdentity();
//    	$this->render('index');
		$this->indexAction();
    }
    
}


